/*
 * VS1053B_Common.h
 *
 *  Created on: 2021年4月12日
 *      Author: slh95
 */

#ifndef VS1053B_VS1053B_COMMON_H_
#define VS1053B_VS1053B_COMMON_H_

#define DREQ_PIN			GPIO_PIN_7
#define DREQ_PORT			GPIOD
#define DREQ_PIN_EN()		__HAL_RCC_GPIOD_CLK_ENABLE()
#define DREQ_PIN_DIS()		__HAL_RCC_GPIOD_CLK_DISABLE()
#define DREQ()				HAL_GPIO_ReadPin(DREQ_PORT, DREQ_PIN)

#define XCS_PIN				GPIO_PIN_3
#define XCS_PORT			GPIOD
#define XCS_PIN_EN()		__HAL_RCC_GPIOD_CLK_ENABLE()
#define XCS_PIN_DIS()		__HAL_RCC_GPIOD_CLK_DISABLE()
#define XCS_EN()			HAL_GPIO_WritePin(XCS_PORT, XCS_PIN, GPIO_PIN_RESET)
#define XCS_DIS()			HAL_GPIO_WritePin(XCS_PORT, XCS_PIN, GPIO_PIN_SET)

#define XDCS_PIN			GPIO_PIN_6
#define XDCS_PORT			GPIOD
#define XDCS_PIN_EN()		__HAL_RCC_GPIOD_CLK_ENABLE()
#define XDCS_PIN_DIS()			__HAL_RCC_GPIOD_CLK_DISABLE()
#define XDCS_EN()			HAL_GPIO_WritePin(XDCS_PORT, XDCS_PIN, GPIO_PIN_SET)
#define XDCS_DIS()			HAL_GPIO_WritePin(XDCS_PORT, XDCS_PIN, GPIO_PIN_RESET)

#define XRESET_PIN			GPIO_PIN_9
#define XRESET_PORT			GPIOG
#define XRESET_PIN_EN()		__HAL_RCC_GPIOG_CLK_ENABLE()
#define XRESET_PIN_DIS()	__HAL_RCC_GPIOG_CLK_DISABLE()
#define XRESET_LOW()		HAL_GPIO_WritePin(XRESET_PORT, XRESET_PIN, GPIO_PIN_RESET)
#define XRESET_HIGH()		HAL_GPIO_WritePin(XRESET_PORT, XRESET_PIN, GPIO_PIN_SET)

extern void VS1053B_PIN_Init(void);
extern void VS1053B_SPI_Test(void);


#endif /* VS1053B_VS1053B_COMMON_H_ */
